//by qyzyq
#include <bits/stdc++.h>

using namespace std;

int main()
{
	freopen ("candy.in", "r", stdin);
	freopen ("candy.out", "w", stdout);
	int n, l, r;
	scanf("%d%d%d", &n, &l, &r);
	int irt = floor (r / n) * n;
	if (irt - 1 >= l)
		printf("%d\n", n - 1);
	else printf("%d\n", r - irt);
	return 0;
}
